package com.jp.knowledge.util;

import android.content.Context;
import android.graphics.BitmapFactory;

/**
 * Created by 528787067@qq.com on 2017/2/14.
 * 头像上传
 */

public class HeadIconUploader extends MultipleImageUploader {

    public HeadIconUploader(Context context) {
        super(context);
    }

    public HeadIconUploader(Context context, int compressQuality) {
        super(context, compressQuality);
    }

    public HeadIconUploader(Context context, boolean cleanCacheAfterUpload) {
        super(context, cleanCacheAfterUpload);
    }

    public HeadIconUploader(Context context, int compressQuality, boolean cleanCacheAfterUpload) {
        super(context, compressQuality, cleanCacheAfterUpload);
    }

    // 计算缩放比例，此处将头像最小边压缩到300
    @Override
    protected float calculateInSampleSize(BitmapFactory.Options options) {
        float inSimpleSize = 1.0f;
        inSimpleSize = Math.min(options.outWidth, options.outHeight)/300.0f;
        return inSimpleSize;
    }
}
